<template>
  <div id="baobao">
    <header>
      <h2><i>爆爆团</i> </h2>
      <div class="up-center">
        <section><span class="iconfont icon-shenglvehao"></span></section>
        <section><span class="iconfont icon-guanbi1"></span></section>
      </div>
    </header>
    <main>
      <div class="top">
        <h2>即将爆款 超级低价</h2>
      </div>
      <div class="center">
        <div class="center-flex">
          <p @click="onTabClick(1)" :class="{ active: activeTab === 1 }">
            正在抢购
          </p>
          <p @click="onTabClick(0)" :class="activeTab === 0 ? 'active' : ''">
            上新预告
          </p>
        </div>
      </div>
      <div class="footer">
        <div class="deail" v-for="(item, index) in shoplist" :key="index">
          <div class="img">
            <img :src="item.picture" alt="" />
          </div>
          <div class="text">
            <p><span>汉堡王 | 北美新天地</span></p>
            <h4>{{ item.name }}</h4>
            <section>
              <div class="left">
                <p>爆爆团价</p>
                <p>￥{{ item.min_price }}<span>5折</span></p>
                <s>￥50</s>
              </div>
              <div class="right">
                <button>马上抢</button>
                <p>{{ item.month_saled_content }}份</p>
              </div>
            </section>
          </div>
        </div>
      </div>
      <div class="kongbai"></div>
    </main>
  </div>
</template>

<script>
import axios from "axios";
import  {tuan_list} from '../../utils/api'
export default {
  data() {
    return {
      activeTab: 1,
      shoplist: [],
    }
  },
  methods: {
    onTabClick(index) {
      this.activeTab = index;
         tuan_list({ status: this.activeTab })
        .then((res) => {
          this.shoplist = res.data.list;
          console.log(res.data.list);
        })
    }
  },
  mounted() {
    this.onTabClick(1);
    this.activeTab = 1;
    
  }
}
</script>

<style lang="scss"  scoped>
/* 头部 */
header {
  height: 45px;
  display: flex;
  justify-content: space-between;
  background-color: #fc3826;
  position: sticky;
  top: 0;

  h2 {
    margin-left: 130px;
    color: white;
  }

  .up-center {
    width: 80px;
    height: 30px;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-around;
    text-align: center;
    line-height: 30px;
    border-radius: 15px;
    margin-top: 7px;
    margin-right: 10px;
    color: #fff;
  }
}
main {
  flex: 1;
  overflow-y: scroll;

  .top {
    height: 98px;
    background-image: linear-gradient(#ff0000, #ed7d30, #f3b33f);
    text-align: center;
    line-height: 98px;
  }
  .top h2 {
    font-size: 30px;
    color: #fbe6be;
  }
  .center {
    padding-left: 12px;
    height: 43px;
    color: #fff;
    background-image: linear-gradient(#f3b33f, #f4e0b2);

    .center-flex {
      width: 150px;
      display: flex;
      justify-content: space-between;

      .center-flex p {
        width: 75px;
        padding-right: 20px;
      }
      .active {
        color: #ed7d30;
        font-weight: 900;
      }
    }
  }
  .footer {
    /* height: 100%; */
    background-image: linear-gradient(#f4e0b2, #ebe7e7);

    .deail {
      height: 150px;
      margin: 0px 12px;
      background-color: #fff;
      border-radius: 20px;
      display: flex;
      justify-content: flex-start;
      margin-bottom: 10px;

      .img img {
        width: 125px;
        height: 125px;
        margin:10px;
      }
      .text > p span {
        font-size: 12px;
        color: #cecaca;
      }
      .text h4 {
        width: 190px;
        font-size: 16px;
        margin-top: 5px;
        margin-bottom: 5px;
      }
      section {
        display: flex;
        justify-content: space-between;
      }
      section .left p:nth-child(1) {
        font-size: 12px;
        color: #fc3826;
      }
      section .left p:nth-child(2) {
        font-size: 18px;
        color: #fc3826;
        display: flex;
        justify-content: flex-start;
      }
      section .left p:nth-child(2) span {
        text-align: center;
        height: 20px;
        line-height: 20px;
        width: 30px;
        display: block;
        border: 1px solid #fc3826;
        font-size: 12px;
        color: #fc3826;
        border-radius:5px;
        margin-left: 3px;
        margin-top: 3px;
      }
      .left s {
        font-size: 12px;
        color: #cecaca;
      }
      .right button {
        width: 75px;
        height: 30px;
        border-radius: 20px;
        background-color: #fc3826;
        color: #fff;
        outline: none;
        border: none;
        margin-bottom: 10px;
        margin-top: 10px;
        margin-left: 30px;
      }
      .right p {
        font-size: 12px;
        color: #fc3826;
        text-indent: 50px;
       
      }
    }
  }
}
.kongbai{
  height: 50px;
}
</style>